#!/usr/bin/python
# -*- coding:utf-8 -*-
# @FileName : python_test9_4.py
# Author    : myh

# 练习 9.4：就餐人数　在为练习 9.1 编写的程序中，添加一个名为
# number_served 的属性，并将其默认值设置为 0。根据这个类创建一
# 个名为 restaurant 的实例。打印有多少人在这家餐馆就餐过，然后
# 修改这个值并再次打印。
# 添加一个名为 set_number_served() 的方法，用来设置就餐人
# 数。调用这个方法并向它传递新的就餐人数，然后再次打印这个值。
# 添加一个名为 increment_number_served() 的方法，用来让就餐
# 人数递增。调用这个方法并向它传递一个这样的值：你认为这家餐馆
# 每天可能接待的就餐人数。
class Restaurant:
    def __init__(self, restaurant_name, cuisine_type):
        self.restaurant_name = restaurant_name
        self.cuisine_type = cuisine_type
        self.number_served = 0

    def describe_restaurant(self):
        print(f"restaurant's name is {self.restaurant_name}."
              f"\n cuisine's type is {self.cuisine_type}.")

    def open_restaurant(self):
        print(f"{self.restaurant_name} is open")

    def set_number_served(self,num):
        self.number_served = num

    def increment_number_served(self):
        self.number_served = self.number_served + 1


if __name__ == '__main__':
    rest = Restaurant('A', 'B')
    print(f'{rest.number_served} person in this restaurant for lunch')
    rest.number_served = 10
    print(f'{rest.number_served} person in this restaurant for lunch')

    rest.set_number_served(5)
    print(f'{rest.number_served} person in this restaurant for lunch')

    rest.increment_number_served()
    print(f'{rest.number_served} person in this restaurant for lunch')
